/*
 Copyright (c) 2008  Seth Bourget  <seth@cafesilencio.net>
 All rights reserved.

 Licensed under the Apache License, Version 2.0 (the "License"); 
 you may not use this file except in compliance with the License. 
 You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 
 Unless required by applicable law or agreed to in writing, 
 software distributed under the License is distributed on an "AS IS" BASIS, 
 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 
 See the License for the specific language governing permissions and limitations under the License. 

 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
 INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
 PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
 HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
 OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
 SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

version 1.0
*/
package net.cafesilencio.awssimpledb
{
	public class SimpleDBQueryObject
	{
		public static const COMPARISON_EQUALS:String 				= "=";
		public static const COMPARISON_NOT_EQUALS:String 			= "!=";
		public static const COMPARISON_GREATER_THAN:String 			= ">";
		public static const COMPARISON_LESS_THAN:String 			= "<";
		public static const COMPARISON_GREATER_THAN_EQUAL_TO:String = ">=";
		public static const COMPARISON_LESS_THAN_EQUAL_TO:String  	= "<=";
		public static const COMPARISON_STARTS_WITH:String 			= "starts-with";
		public static const COMPARISON_NOT_START_WITH:String 		= "does-not-start-with";
		
		private var key:String = null;
		private var value:String = null;
		private var comparisonOperator:String = null;
		
		public function SimpleDBQueryObject()
		{

		}
		
		public function setAttributeName(name:String):void
		{	key = name;	}
		
		public function setAttributeValue(value:String):void
		{	this.value = value;	}
		
		public function setComparisonOperator(comparisonOperator:String):void
		{
			this.comparisonOperator = comparisonOperator;
		}
		
		
		public function getQueryString():String
		{
			if(key == null || value == null || comparisonOperator == null)
				return null;
			else
				return "['" + key + "' " + comparisonOperator + " '" + value + "']";
		}

	}
}